<script setup>
const emit = defineEmits(['update-title'])

const props = defineProps({
  title: Number
})
const addTitle = () => {
  const newTitle = props.title + 1
  emit('update-title', newTitle)
}
</script>
<template>
  <div style="width: 100px; height: 100px; border: 3px solid">
    我是子组件{{ title }}
    <button @click="addTitle">修改内容</button>
  </div>
</template>
